<?php  
include 'codeBack.config.php';
include "connectMysql.php";
include "empty.php";
include "header.php";

$user_id = $_POST['user_id'];
$token = $_POST['token'];
$id = $_POST['id'];
$user_name = $_POST["user_name"];
$user_img = $_POST["user_img"];

if(!$user_name || !$token || !$id || !$user_name || !$user_img){
	exit();
}

$ac_user_sql = "SELECT * FROM ac_user WHERE user_id='$user_id' AND token='$token'";
$ac_user_result = $mysqli->query($ac_user_sql);
$ac_user_row = mysqli_fetch_object($ac_user_result);
if($ac_user_row->token == $token && $ac_user_row->user_id == $user_id){
	// 查找成功
	$ac_user_info_sql = "SELECT date,morning,afternoon,evening,other FROM ac_user_info WHERE user_id='$user_id' AND id='$id'";
	$ac_user_info_result = $mysqli->query($ac_user_info_sql);
	$ac_user_info_row = mysqli_fetch_object($ac_user_info_result);
	if(count(((array)$ac_user_info_row))){
		// 大于 0 表示插入成功
		// 插入成功
		$data = [
			"code"=>$CodeBack["INFO_SUCCESS_CODE"],
			"user_id"=>$ac_user_row->user_id,
			"id"=>$id,
			"data"=>$ac_user_info_row,
			"message"=>"查看详细信息成功",
		];
		echo json_encode($data);
	}else {
		$data = [
			"code"=>$CodeBack["INFO_FAILED_CODE"],
			"message"=>"查看详细信息失败",
		];
		echo json_encode($data);
	}
}